﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>prospects</title>
    <link href="~/Content/BootstrapSouce/css/bootstrap.css" rel="stylesheet" />
    <script src="~/Content/BootstrapSouce/js/jquery.min.js"></script>
    <script src="~/Content/BootstrapSouce/js/bootstrap.min.js"></script>
    <script src="~/Content/EasyUI/jquery.min.js"></script>

    <script>

        function checke(url)
        {
            var Checkbox1 = $("#Checkbox1:checked").val();
            var state=$("#Checkbox1:checked").attr("evve");
            
            if(Checkbox1==null)
            {
                alert('请至少选择一个项目！');
                return ;
            }
            else
            {
                if(state>=2)
                {
                    alert('勘察已经结束，不可修改');
                    return;
                }
                location.href =url+Checkbox1;
            }
        }
        ///区位
        function Lacation()
        {
            checke("/Location/LocationIndex?id=");
        }
        //小区
        function Xiaoqu()
        {
            checke("/Village/VillageIndex?id=");

        }
        ///现场照片
        function photo() {
            checke("/Photos/index?id=");

        }
        ///询价
        function XunJia()
        {
            checke("/Inquiry/InquiryIndex?id=");
        }
        //楼状
        function floor() {
            checke("/floors/index?id=");
        }
        //详情
        function single()
        {
            var Checkbox1 = $("#Checkbox1:checked").val();
            if(Checkbox1==null)
            {
                alert('请至少选择一个项目！');
                return;
            }
            var idd = $("#Checkbox1:checked").next().val();
            location.href = "/single/index?id=" + Checkbox1+"&idd="+idd;
        }
        //勘察完成状态
        function UptOne(id)
        {
            $.ajax({
                type:"post",
                url:"http://localhost:63805/apis/prospect/ProUptOne?name="+id,
                success:function(obj)
                {
                    if(obj>0)
                    {
                        alert("勘察完成!");
                        location.reload();
                    }
                    else{
                        alert("失败!");
                    }
                }
            })
        }
        ///审核
        function UptTwo(id)
        {
            $.ajax({
                type:"post",
                url:"http://localhost:63805/apis/prospect/ProUptTwo?name="+id,
                success:function(obj)
                {
                    if(obj>0)
                    {
                        alert("审核成功!");
                        location.href='/prospect/prospects';
                    }
                    else{
                        alert("失败!");
                    }
                }
            })
        }
        //室内
        function ShiNei() {
            checke("/Indoor/IndoorIndex?id=");
            
        }

    </script>


</head>


<body>
    <div>
        <div class="row" style="height:50px">
            <div class="col-md-12" style="line-height:50px;margin-top:10px; background-color:#808080">

            </div>
        </div>
        <div class="row" style="height:50px">
            <div class="col-md-12" style="line-height:50px">
                <input id="Button1" type="button" value="勘察复用" class="btn btn-primary" style="margin-left:20px" /><input id="Button1" type="button" value="区位状况勘察" class="btn btn-primary" style="margin-left:20px" onclick="Lacation()" /><input type="button" value="小区状况勘察" class=" btn btn-primary" style="margin-left:20px" onclick="    Xiaoqu()" /><input id="Button1" type="button" value="楼状况勘察" class="btn btn-primary" style="margin-left:20px" onclick="    floor()" /><input id="Button1" type="button" value="室内况勘察" class="btn btn-primary" style="margin-left:20px" onclick="ShiNei()" /><input id="Button1" type="button" value="现场照片提供" class="btn btn-primary" style="margin-left:20px" onclick="    photo()" /><input id="Button1" type="button" value="询价记录" class="btn btn-primary" style="margin-left:20px" onclick="    XunJia()" /><input id="Button1" type="button" value="详情" class="btn btn-primary" style="margin-left:20px" onclick="single()" /><input id="Button1" type="button" value="审核详情" class="btn btn-primary" style="margin-left:20px" />

            </div>
        </div>
        <div class="row">
            <div class="col-md-12">
                <table class="table table-hover text-c">
                    <tr>
                        <th><input id="Checkbox1" type="checkbox" /></th>
                        <th>项目号</th>
                        <th>所属部门</th>
                        <th>联系人</th>
                        <th>联系人电话</th>
                        <th>房屋坐落</th>
                        <th>登记日期</th>
                        <th>项目状态</th>
                        <th>操作</th>
                    </tr>
                    @foreach (var i in Model)
                    {
                        <tr>
                            <td><input id="Checkbox1" type="checkbox" value="@i.projectNumber" evve="@i.basic_State"/><input id="idd" type="hidden" value="@i.basic_State" /></td>
                            <td>@i.projectNumber</td>
                            <td>@i.department_Name</td>
                            <td>@i.loan_Contacts</td>
                            <td>@i.loan_ContactsTEL</td>
                            <td>@i.house_Located</td>
                            <td>@i.basic_CreateTime</td>
                            @switch ((int)i.basic_State)
                            {
                                case 0:
                                    <td>
                                        待勘察
                                    </td>
                                    break;
                                case 1:
                                <td>
                                    正在勘察
                                </td>
                                    break;
                                case 2:
                                <td>
                                    评估中
                                </td>
                                    break;
                                case 3:
                                <td>
                                    审核中
                                </td>
                                    break;
                                case 4:
                                <td>
                                    审核中
                                </td>
                                    break;
                                case 5:
                                <td>
                                    审核中
                                </td>
                                    break;
                                case 6:
                                <td>
                                    审核中
                                </td>
                                    break;
                                case 7:
                                <td>
                                    审核通过
                                </td>
                                    break;

                            }
                            <td>
                                @if (i.basic_State == 1)
                                {
                                    <input id="Button1" type="button" value="结束勘察" onclick="UptOne(@i.projectNumber)" />
                                }
                            </td>
                        </tr>
                    }
                </table>
            </div>
        </div>
        <div class="row"></div>
    </div>
</body>
</html>
